package com.codbking.calendar.exaple.dialog;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;

import com.codbking.calendar.exaple.OnBHClickListener;
import com.codbking.calendar.exaple.R;
import com.codbking.calendar.exaple.databinding.DialogInCommonBinding;

/**
 * Created by SensYang on 2019/06/12 23:46
 */
public class InCommonDialog extends BaseDialog {
    Context context;
    DialogInCommonBinding inComminBinding ;
    OnBHClickListener onBHClickListener;

    public InCommonDialog(Context context) {
        super(context);
        this.context = context;
        inComminBinding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.dialog_in_common,null,false);
        inComminBinding.setDialog(this);
        setContentView(inComminBinding.getRoot());
    }

    public void setOnBHClickListener(OnBHClickListener onBHClickListener) {
        this.onBHClickListener = onBHClickListener;
    }

    //继续上工
    public void noPoint(View view){
        if (onBHClickListener != null) {
            onBHClickListener.onCloseClick();
        }
        dismiss();
    }

    //查看上工
    public void okPoint(View view){
        String info = inComminBinding.etModuleThing.getText().toString().trim();
        if (TextUtils.isEmpty(info)) {
            Toast.makeText(context,"请输入内容",Toast.LENGTH_SHORT).show();
            return;
        }

        if (onBHClickListener != null) {
            onBHClickListener.onConfirmClick(info);
        }
        dismiss();
    }
}

